package cn.com.headfree.util;

import cn.com.headfree.entity.*;
import cn.com.headfree.vo.simple.*;
import org.apache.log4j.Logger;

import java.text.SimpleDateFormat;
//import java.util.ArrayList;
import java.util.List;

/**
 * 个人信息工具类
 */
public class PerInfoUtil {

    private static final Logger log = Logger.getLogger(PerInfoUtil.class);

    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");

    /**
     * 组装个人基本信息
     *
     * @param list   查询到的个人基本信息集合
     * @param titles 个人基本信息的表头
     * @return empBaseInfo=id,ERP编号,姓名,性别,出生日期,民族,籍贯,出生地,参加工作时间,政治面貌,入党团时间,岗级,薪档,身份证号码,手机号码,单位,部门,岗位
     */
    public static String[][] zhEmpBaseInfo(List<EmpBaseInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
                content[i][3] = list.get(i).getSex();
//                content[i][3] = sdf.format(list.get(i).getBirthDate());
                content[i][4] = list.get(i).getBirthDateStr();
                content[i][5] = list.get(i).getNation();
                content[i][6] = list.get(i).getBirthPlace();
                content[i][7] = list.get(i).getBornPlace();
                content[i][8] = list.get(i).getJobDateStr();
                content[i][9] = list.get(i).getPolitiStatus();
                content[i][10] = list.get(i).getPartyDateStr();
                content[i][11] = list.get(i).getLevel();
                content[i][12] = list.get(i).getSalaryGrade();
//                content[i][11] = sdf.format(list.get(i).getPartyDate());
                content[i][13] = list.get(i).getIdCardNo();
//                content[i][12] = sdf.format(list.get(i).getJobDate());
                content[i][14] = list.get(i).getMobilePhone();
                content[i][15] = list.get(i).getUnit();
                content[i][16] = list.get(i).getDept();
                content[i][17] = list.get(i).getCurPost();
            }
        }
        return content;
    }

    /**
     * 竞赛考试信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 竞赛考试获奖时间, 专业竞赛考试名称, 专业竞赛主办部门, 竞赛考试获奖级别, 竞赛考试名次, 是否获得称号
     * @return id,ERP编号,姓名,竞赛考试获奖时间,专业竞赛考试名称,专业竞赛主办部门,竞赛考试获奖级别,竞赛考试名次,是否获得称号
     */
    public static String[][] zhContestInfo(List<ContestInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getAwardDate());
                content[i][3] = list.get(i).getAwardDateStr();
                content[i][4] = list.get(i).getCompName();
                content[i][5] = list.get(i).getHostOrg();
                content[i][6] = list.get(i).getAwardLevel();
                content[i][7] = list.get(i).getCompRank();
                content[i][8] = list.get(i).getGetTitle();
            }
        }
        return content;
    }

    /**
     * 组合学术成果
     *
     * @param list
     * @param titles
     * @return id, 发表时间, 类别(专著 、 论文), 论文(专著)名称, 内容摘要, 刊物名称, 卷/期数(刊物),页码,期刊号,出版社名称,级别,角色,作者姓名,作者排序
     */
    public static String[][] zhAcadeAchiveInfo(List<AcadeAchiveInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getPubTimeStr();
                content[i][2] = list.get(i).getAcadType();
                content[i][3] = list.get(i).getAcadName();
                content[i][4] = list.get(i).getSummary();
                content[i][5] = list.get(i).getPubName();
                content[i][6] = list.get(i).getPeriodicNo();
                content[i][7] = list.get(i).getPage() + "";
                content[i][8] = list.get(i).getIssn();
                content[i][9] = list.get(i).getPublisher();
                content[i][10] = list.get(i).getLevel();
                content[i][11] = list.get(i).getRole();
                content[i][12] = list.get(i).getUserName();
                content[i][13] = list.get(i).getRank() + "";

            }
        }
        return content;
    }

    /**
     * 教育培训及授课经历
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 培训开始时间, 培训结束时间, 类型, 专业或主要内容, 学习、授课地点,证明人
     * @return id,ERP编号,姓名,培训开始时间,培训结束时间,类型,专业或主要内容,学习、授课地点,证明人
     */
    public static String[][] zhContiStudyInfo(List<ContiStudyInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getStartTime());
                content[i][3] = list.get(i).getStartTimeStr();
//                content[i][3] = sdf.format(list.get(i).getEndTime());
                content[i][4] = list.get(i).getEndTimeStr();
                content[i][5] = list.get(i).getType() + "";
                content[i][6] = list.get(i).getMajor();
                content[i][7] = list.get(i).getStudyPlace();
                content[i][8] = list.get(i).getCertifier();
            }
        }
        return content;
    }

    /**
     * 组合学历信息
     *
     * @param list
     * @param titles
     * @return educateInfo=ERP编号,姓名,学习开始时间,学习结束时间,学历取得时间,是否全日制,毕业院校,院校类别,所学专业,学历名称,学位名称
     * @return educateInfo=id,ERP编号,姓名,学习开始时间,学习结束时间,学历取得时间,是否全日制,毕业院校,院校类别,所学专业,学历名称,学位名称
     */
    public static String[][] zhEducateInfo(List<EducateInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = list.get(i).getIdCardNo();
                content[i][3] = list.get(i).getStartTimeStr();
                content[i][4] = list.get(i).getEndTimeStr();
                content[i][5] = list.get(i).getAcquTimeStr();
                content[i][6] = list.get(i).getIsContEduc();
                content[i][7] = list.get(i).getGradSchool();
//                content[i][7] = sdf.format(list.get(i).getAcquTime());
                content[i][8] = list.get(i).getSchoolType();
                content[i][9] = list.get(i).getMajor();
//                content[i][9] = sdf.format(list.get(i).getStartTime());
                content[i][10] = list.get(i).getEducName();
//                content[i][10] = sdf.format(list.get(i).getEndTime());
                content[i][11] = list.get(i).getDegreeName();
            }
        }
        return content;
    }

    /**
     * 专家人才称号信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 类别, 专业, 人才称号名称, 专家等级, 取得时间, 聘期开始日期, 聘期结束日期
     * @return id,ERP编号,姓名,类别,专业,人才称号名称,专家等级,取得时间,聘期开始日期,聘期结束日期
     */
    public static String[][] zhExpertTitleInfo(List<ExpertTitleInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
                content[i][3] = list.get(i).getType();
//                content[i][3] = sdf.format(list.get(i).getAcquTime());
                content[i][4] = list.get(i).getMajor();
                content[i][5] = list.get(i).getEmpTitle();
                content[i][6] = list.get(i).getLevelName();
                content[i][7] = list.get(i).getAcquTimeStr();
//                content[i][7] = sdf.format(list.get(i).getEmpTermStart());
                content[i][8] = list.get(i).getEmpTermStartStr();
//                content[i][8] = sdf.format(list.get(i).getEmpTermEnd());
                content[i][9] = list.get(i).getEmpTermEndStr();
            }
        }
        return content;
    }

    /**
     * 组合个人荣誉信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 取得时间, 荣誉称号, 授予单位/部门,荣誉级别,荣誉类别
     * @return id,ERP编号,姓名,取得时间,荣誉称号,授予单位/部门,荣誉级别,荣誉类别
     */
    public static String[][] zhHonorInfo(List<HonorInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getAcquTime());
                content[i][3] = list.get(i).getAcquTimeStr();
                content[i][4] = list.get(i).getHonorTitle();
                content[i][5] = list.get(i).getAwardOrg();
                content[i][6] = list.get(i).getHonorLevel();
                content[i][7] = list.get(i).getHonorType();
            }
        }
        return content;
    }

    /**
     * 组合专利信息
     *
     * @param list
     * @param titles
     * @return id, 名称, 专利号, 类型, 专利申请日, 授权公告日, 发明人(专利权人)姓名, 排序
     */
    public static String[][] zhPatentInfo(List<PatentInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getPatentName();
                content[i][2] = list.get(i).getPatentNo();
                content[i][3] = list.get(i).getPatentType();
//                content[i][3] = sdf.format(list.get(i).getApplyDate());
                content[i][4] = list.get(i).getApplyDateStr();
//                content[i][4] = sdf.format(list.get(i).getDeclDate());
                content[i][5] = list.get(i).getDeclDateStr();
//                content[i][6] = list.get(i).getInventor();
                content[i][6] = list.get(i).getUserName();
                content[i][7] = list.get(i).getRank() + "";
            }
        }
        return content;
    }

    /**
     * 组合专业技术资格信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 取得时间, 专业技术资格名称, 专业技术资格系列, 专业技术资格等级, 审批单位, 审批单位级别, 证书编号
     * @return id,ERP编号,姓名,取得时间,专业技术资格名称,专业技术资格系列,专业技术资格等级,审批单位,审批单位级别,证书编号
     */
    public static String[][] zhProTecInfo(List<ProTecInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getAcquTime());
                content[i][3] = list.get(i).getAcquTimeStr();
                content[i][4] = list.get(i).getSubjName();
                content[i][5] = list.get(i).getSubjSet();
                content[i][6] = list.get(i).getSubjLevel();
                content[i][7] = list.get(i).getAuditOrg();
                content[i][8] = list.get(i).getOrgLevel();
                content[i][9] = list.get(i).getCertNo();
            }
        }
        return content;
    }

    /**
     * 项目课程成果
     *
     * @param list
     * @param titles
     * @return id, 项目开始时间, 项目结束时间, 课题名称, 内容摘要, 项目、课题级别,获得奖励及社会经济效益,小组成员姓名,角色,排序
     */
    public static String[][] zhProjAchieveInfo(List<ProjAchieveInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
//                content[i][0] = sdf.format(list.get(i).getStartDate());
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getStartDateStr();
//                content[i][1] = sdf.format(list.get(i).getEndDate());
                content[i][2] = list.get(i).getEndDateStr();
                content[i][3] = list.get(i).getProjName();
                content[i][4] = list.get(i).getSummary();
                content[i][5] = list.get(i).getProjLevel();
                content[i][6] = list.get(i).getEncourage();
                content[i][7] = list.get(i).getUserName();
                content[i][8] = list.get(i).getRole() + "";
                content[i][9] = list.get(i).getRank() + "";
            }
        }
        return content;
    }

    /**
     * 组合师带徒徒弟信息
     *
     * @param list
     * @param titles
     * @return
     */
    public static String[][] zhSdtPrentInfo(List<TSdtPrentInfo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getErpNo();
                content[i][1] = list.get(i).getIdCardNo();
                content[i][2] = list.get(i).getAwardName();
                content[i][3] = list.get(i).getWinInfo();
            }
        }
        return content;
    }

    /**
     * 组合导师带徒--暂不处理
     *
     * @param list
     * @param titles
     * @return id, 导师ERP编号, 导师姓名, 师带徒内容摘要, 师带徒开始时间, 师带徒结束时间, 徒弟姓名, 徒弟所获奖项
     */
    public static String[][] zhSdtTutorPrentInfo(List<SdtTutorPrentInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getTutorName();
                content[i][3] = list.get(i).getTeachSummary();
                content[i][4] = list.get(i).getStartDateStr();
                content[i][5] = list.get(i).getEndDateStr();
//                content[i][6] = list.get(i).getPrentName();
                content[i][6] = list.get(i).getUserName();
                content[i][7] = list.get(i).getPrentAwardName();
            }
        }
        return content;
    }

    /**
     * 组合技能等级信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 取得时间, 技能鉴定工种, 职业资格等级, 审批单位, 审批单位级别, 证书编号
     * @return id,ERP编号,姓名,取得时间,技能鉴定工种,职业资格等级,审批单位,审批单位级别,证书编号
     */
    public static String[][] zhSkillLevelInfo(List<SkillLevelInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getAcquTime());
                content[i][3] = list.get(i).getAcquTimeStr();
                content[i][4] = list.get(i).getTechType();
                content[i][5] = list.get(i).getQualifiLevel();
                content[i][6] = list.get(i).getAuditOrg();
                content[i][7] = list.get(i).getOrgLevel();
                content[i][8] = list.get(i).getCertNo();
            }
        }
        return content;
    }

    /**
     * 组合制度标准
     *
     * @param list
     * @param titles
     * @return 颁布时间, 名称, 类别, 级别, 角色, 姓名, 排名
     * id,颁布时间,名称,类别,级别,角色,姓名,排名
     */
    public static String[][] zhStandInfo(List<StandInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
//                content[i][0] = sdf.format(list.get(i).getIssueTime());
                content[i][0] = list.get(i).getId();//id值,不进行导出,用于合并
                content[i][1] = list.get(i).getIssueTimeStr();
                content[i][2] = list.get(i).getName();
                content[i][3] = list.get(i).getType();
                content[i][4] = list.get(i).getLevel();
                content[i][5] = list.get(i).getRole();
                content[i][6] = list.get(i).getUserName();
                content[i][7] = list.get(i).getRank() + "";
            }
        }
        return content;
    }

    /**
     * 组合技艺革新信息
     *
     * @param list
     * @param titles
     * @return id, QC成果名称, 内容摘要, QC获奖时间, QC获奖授予单位, QC获奖级别, 奖项等级, 获奖名称, QC小组名称, QC小组成员名称, 排序
     */
    public static String[][] zhTecInnovInfo(List<TecInnovInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getAchiName();
                content[i][2] = list.get(i).getSumary();
//                content[i][2] = sdf.format(list.get(i).getCreateTime());
                content[i][3] = list.get(i).getAwardDateStr();
//                content[i][3] = sdf.format(list.get(i).getAwardDate());
                content[i][4] = list.get(i).getAwardOrg();
                content[i][5] = list.get(i).getAwardLevel();
                content[i][6] = list.get(i).getAwardGrade();
                content[i][7] = list.get(i).getAwardName();
                content[i][8] = list.get(i).getGroupName();
                content[i][9] = list.get(i).getUserName();
                content[i][10] = list.get(i).getRank() + "";
            }
        }
        return content;
    }

    /**
     * 组合科技及管理创新成果
     *
     * @param list
     * @param titles
     * @return id, 成果名称, 内容摘要, 获奖时间, 获奖授予单位, 获奖级别, 奖项等级, 获奖名称, 成果类别, 小组名称, 获奖成员姓名, 排序
     */
    public static String[][] zhTecManInnov(List<TecManInnovVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getAchiName();
                content[i][2] = list.get(i).getSummary();
                content[i][3] = list.get(i).getAwardDateStr();
//                content[i][2] = sdf.format(list.get(i).getCreateTime());
                content[i][4] = list.get(i).getAwardOrg();
//                content[i][3] = sdf.format(list.get(i).getAwardDate());
                content[i][5] = list.get(i).getAwardLevel();
                content[i][6] = list.get(i).getAwardGrade();
                content[i][7] = list.get(i).getAwardName();
                content[i][8] = list.get(i).getAchiType();
                content[i][9] = list.get(i).getGroupName();
                content[i][10] = list.get(i).getUserName();
                content[i][11] = list.get(i).getRank() + "";
            }
        }
        return content;
    }

    /**
     * 组合工作经历信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 工作开始时间, 工作结束时间, 单位, 部门, 职务, 级别, 职务分工, 岗位类别
     * @return id,ERP编号,姓名,工作开始时间,工作结束时间,单位,部门,职务,级别,职务分工,岗位类别
     */
    public static String[][] zhWorkExpInfo(List<WorkExpInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getStartDate());
                content[i][3] = list.get(i).getStartDateStr();
//                content[i][3] = sdf.format(list.get(i).getEndDate());
                content[i][4] = list.get(i).getEndDateStr();
                content[i][5] = list.get(i).getCompany();
                content[i][6] = list.get(i).getDept();
                content[i][7] = list.get(i).getPost();
                content[i][8] = list.get(i).getRank();
                content[i][9] = list.get(i).getJobContent();
                content[i][10] = list.get(i).getPostType();
            }
        }
        return content;
    }

    /**
     * 组合年度绩效信息
     *
     * @param list
     * @param titles
     * @return ERP编号, 姓名, 评级开始时间, 评级结束时间, 评级年度, 绩效等级, 剩余积分, 本年度获取积分
     * @return id,ERP编号,姓名,评级开始时间,评级结束时间,评级年度,绩效等级,剩余积分,本年度获取积分
     */
    public static String[][] zhYearEffectInfo(List<YearEffectInfoVo> list, String[] titles) {
        String[][] content = null;
        if (list != null) {
            content = new String[list.size()][titles.length];
            for (int i = 0; i < list.size(); i++) {
                content[i][0] = list.get(i).getId();
                content[i][1] = list.get(i).getErpNo();
                content[i][2] = list.get(i).getUserName();
//                content[i][2] = sdf.format(list.get(i).getRateYearStart());
                content[i][3] = list.get(i).getRateYearStartStr();
//                content[i][3] = sdf.format(list.get(i).getRateYearEnd());
                content[i][4] = list.get(i).getRateYearEndStr();
                content[i][5] = list.get(i).getRateYear() + "";
                content[i][6] = list.get(i).getPerforGrade();
//                content[i][6] = list.get(i).getResiInte() + "";
                content[i][7] = list.get(i).getResiInteStr();
//                content[i][7] = list.get(i).getCurInte() + "";
                content[i][8] = list.get(i).getCurInteStr();
            }
        }
        return content;
    }


}
